package cn.jaye.fabric.controller.rest;

import cn.jaye.fabric.application.TestApplication;
import cn.jaye.fabric.application.command.ListPeerCommand;
import cn.jaye.fabric.application.command.TestCommand;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Jaye
 * @create 2018-05-31 15:14
 */
@RestController
@RequestMapping("rest")
public class TestRestController {

    @Autowired
    private TestApplication testApplication;

    @PostMapping("test")
    public String list(HttpServletRequest request, TestCommand testCommand) {
        return JSON.toJSONString(testApplication.list(testCommand));
    }
}
